<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ESM</title>
</head>

<body>

    <!-- 1. ESM 采用严格模式 -->
    <script type="module">
        console.log('this', this)
    </script>

    <!-- 2. ESM 有单独的私有作用域 -->
    <script type="module">
        var foo = 'foo'
        console.log('foo', foo)
    </script>
    <script type="module">
        console.log('foo', foo)
    </script>
    <!-- 3. ESM 通过 CORS 方式请求外部js模块 -->
    <script type="module" src="https://pss.bdstatic.com/r/www/cache/static/protocol/https/amd_modules/@baidu/search-sug_947981a.js"></script>
    <!-- 4. EMS script标签会延迟执行脚本 -->
    <!-- !!这里貌似没有用 -->
    <script type="module" src="./index.js"></script>
    <p>要显示的内容</p>
</body>

</html>